from django.contrib import admin

# Register your models here.
from books import models

from books.models import User, Article
class BaseAdmin(admin.ModelAdmin):
    class Media:
        js=(
           '../static/plugins/jquery1.12.4.min.js',
            '../static/css/admin.js',

        )

class UserAdmin(BaseAdmin):
    list_display = ["nickname","phone","email"]
    fields = ["nickname","phone","email"]

class ArticleAdmin(BaseAdmin):
    list_display = ['category','author','title','abstract','like_num','read_num','c_time']
    list_display_links = ['title']
    fields = ['category','author','title','abstract','content']

    class Media:
        js=(
            '../static/plugins/kindeditor/kindeditor-all.js',
            '../static/plugins/kindeditor/lang/zh_CN.js',
            '../static/plugins/kindeditor/config.js',
        )

admin.site.register(User,UserAdmin)
admin.site.register(Article,ArticleAdmin)
